home *** CD-ROM | disk | FTP | other *** search
- {Program Chalo Version 4.0
- Written by Terry Uland, 1992
- Revised 9-30-94, 10-12-94, 10-13-94, 10-14-94, 10-15-94, 10-20-94
- Last revision 1-19-95 -- Rewritten in Turbo Pascal 7.0}
- Program Chalo40;
- {$M $4000,0,0 } { 16K stack, no heap }
- uses crt, dos;
- const
- Path = 'c:\'; {Path }
- Fil = ''; {File name }
- HighScore = ''; {High score value }
- var
- Data : text; {c:\tp\hiscore.dat }
- Instructions : char; {Instructions Question }
- Dummy : char; {Dummy Variable }
- Ac : char; {Difficulty level choice}
- X : integer; {Dummy Variable }
- chap : integer; {Chap }
- players : integer; {Players }
- points : integer; {Points }
- DifficultyLevel : string; {Difficulty Level }
- chaphigh : integer; {Highest chap }
- Cd : char; {Command Choice }
- wager : integer; {Wager }
- die1 : integer; {Die One Value }
- die2 : integer; {Die Two Value }
- roll : integer; {Roll Value }
- name : string; {Name of Player }
- quit : char; {Quit [Y/N] }
- wh : char; {Which One? }
- programname : string; {Executable Program }
- Delete : char; {Delete? }
- DumAss : string; {You shouldn't be here! }
-
-
- Procedure Initialize;
- begin
- Randomize;
- Textmode(co40);
- chap := 1;
- wh := '0';
- end;
-
- Procedure Title;
- begin
- clrscr;
- textcolor(yellow);
- gotoxy (100, 1);
- writeln('CCCCC');
- gotoxy (1, 2);
- writeln('C');
- gotoxy (1, 3);
- writeln ('C');
- gotoxy (1, 4);
- writeln('C');
- gotoxy (1, 5);
- writeln('CCCCC');
- gotoxy (9, 1);
- writeln('H H');
- gotoxy (9, 2);
- writeln('H H');
- gotoxy (9, 3);
- writeln('HHHHH');
- gotoxy (9, 4);
- writeln('H H');
- gotoxy (9, 5);
- writeln('H H');
- gotoxy (17, 1);
- writeln('AAAAA');
- gotoxy (17, 2);
- writeln('A A');
- gotoxy (17, 3);
- writeln('AAAAA');
- gotoxy (17, 4);
- writeln('A A');
- gotoxy (17, 5);
- writeln('A A');
- gotoxy (25, 1);
- writeln('L');
- gotoxy (25, 2);
- writeln('L');
- gotoxy (25, 3);
- writeln('L');
- gotoxy (25, 4);
- writeln('L');
- gotoxy (25, 5);
- writeln('LLLLL');
- gotoxy (33, 1);
- writeln('OOOOO');
- gotoxy (33, 2);
- writeln('O O');
- gotoxy (33, 3);
- writeln('O O');
- gotoxy (33, 4);
- writeln('O O');
- gotoxy (33, 5);
- writeln('OOOOO');
- textcolor(red);
- gotoxy (12, 8);
- writeln('By Waadi Games,');
- gotoxy (4, 10);
- writeln('A Division of Uland Industries');
- textcolor(white);
- gotoxy (1, 15);
- Write('Would you like instructions?(Y/N): ');
- readln(Instructions);
- IF (instructions = 'y') THEN
- begin;
- clrscr;
- textcolor(yellow);
- gotoxy (4, 1);
- writeln('- - - - - C H A L O - - - - -');
- textcolor(lightgray);
- gotoxy (5, 4);
- writeln('Welcome to Chalo. The game is ');
- gotoxy (1, 5);
- writeln('simple. The object of the game is to');
- gotoxy (1, 6);
- writeln('complete 10 chaps, or levels, while ');
- gotoxy (1, 7);
- writeln('earning as many points as possible by ');
- gotoxy (1, 8);
- writeln('wagering. You begin the game with 100 ');
- gotoxy (1, 9);
- writeln('points and 4 players. If you lose all ');
- gotoxy (1, 10);
- writeln('of your players, you lose all of your ');
- gotoxy (1, 11);
- writeln('winnings. The first decision to be ');
- gotoxy (1, 12);
- writeln('made is the path. If you chose the long');
- gotoxy (1, 13);
- writeln('path, game play proceeds normally. ');
- gotoxy (1, 14);
- writeln('However, if you select the short one,');
- gotoxy (1, 15);
- writeln('the chances of losing a player are ');
- gotoxy (1, 16);
- writeln('doubled, but so are the winnings.');
- gotoxy (1, 17);
- writeln('The second decision is the wager. It ');
- gotoxy (1, 18);
- writeln('cannot be over the amount you have, and ');
- gotoxy (1, 19);
- writeln('minimum bet is 1 point. Remember, if ');
- gotoxy (1, 20);
- writeln('you lose al your players, you lose all');
- gotoxy (1, 21);
- writeln('your winnings. Good Luck!');
- end;
- textcolor(white);
- gotoxy (3, 23);
- write('Press <RETURN> to continue . . .');
- read(dummy);
- end;
- {*******}
- procedure getcustom;
- begin
- textbackground(black);
- clrscr;
- textcolor(yellow);
- gotoxy (4, 1);
- writeln('- - - - - C H A L O - - - - -');
- textcolor(cyan);
- gotoxy (8, 6);
- writeln('Input Custom Settings');
- gotoxy (5, 11);
- writeln('Highest Chap : ');
- gotoxy (5, 15);
- writeln('Number of players : ');
- gotoxy (5, 19);
- writeln('Starting Cash : ');
- gotoxy (25, 11);
- read(chaphigh);
- gotoxy (25, 15);
- read(players);
- gotoxy (25, 19);
- read(points);
- textcolor(white);
- repeat
- gotoxy (8, 23);
- writeln('Press any key to continue. ');
- until keypressed;
- end;
-
- {*******}
- procedure prochoice;
- begin
- textbackground(black);
- clrscr;
- textcolor(yellow);
- gotoxy (4, 1);
- writeln('- - - - - C H A L O - - - - -');
- textcolor(cyan);
- gotoxy (8, 5);
- writeln('Choose Difficulty Level');
- gotoxy (5, 8);
- writeln('1. Beginner');
- gotoxy (5, 10);
- writeln('2. Intermediate');
- gotoxy (5, 12);
- writeln('3. Expert');
- gotoxy (5, 14);
- writeln('4. Master');
- gotoxy (5, 16);
- writeln('5. Grand Master');
- gotoxy (5, 18);
- writeln('6. Custom');
- repeat
- gotoxy (7, 22);
- write('What level would you like? ');
- read(ac);
- until (ac = '1') or (ac = '2') or (ac = '3') or (ac = '4') or (ac = '5') or (ac = '6');
- If ac = '1' THEN
- begin;
- chaphigh := 10;
- players := 6;
- points := 150;
- difficultylevel := 'Beginner';
- end;
- IF ac = '2' THEN
- begin;
- chaphigh :=10;
- players := 4;
- points := 100;
- difficultylevel := 'Intermediate';
- end;
- IF ac = '3' THEN
- begin;
- chaphigh := 15;
- players := 4;
- points := 75;
- difficultylevel := 'Expert'
- end;
- IF ac = '4' THEN
- begin;
- chaphigh := 15;
- players := 3;
- points := 50;
- difficultylevel := 'Master';
- end;
- IF ac = '5' THEN
- begin;
- chaphigh := 20;
- players := 3;
- points := 25;
- difficultylevel := 'Grand Master';
- end;
- IF ac = '6' THEN getcustom;
- end;
- {*******}
- procedure outputdata;
- begin;
- {dt$ = DATE$
- tm$ = TIME$}
- assign(data, 'c:\tp\hiscore.dat');
- append(data);
- writeln(data, name:20, points:20, difficultylevel:20);
- close(data)
- end;
- {*******}
- procedure hiscore;
- begin
- textbackground(black);
- clrscr;
- textcolor(yellow);
- gotoxy (4, 1);
- writeln('- - - - - C H A L O - - - - -');
- textcolor(white);
- gotoxy (8, 5);
- writeln('High Score Utilities');
- textcolor(13);
- gotoxy (5, 9);
- writeln('1. View High Scores');
- gotoxy (5, 11);
- writeln('2. Reset High Scores');
- gotoxy (5, 13);
- writeln('3. Print High Scores');
- gotoxy (5, 15);
- writeln('4. Exit Utilities');
- textcolor(12);
- repeat
- gotoxy (11, 19);
- write('Which One: ');
- read(wh);
- until (wh = '1') or (wh = '2') or (wh = '3') or (wh = '4');
- IF wh = '1' THEN
- begin;
- textmode(co80);
- ProgramName := '/c c:\tp\viewhi.bat';
- SwapVectors;
- Exec(GetEnv('COMSPEC'), programname);
- SwapVectors;
- readln;
- textmode(co40);
- end;
- IF wh = '2' THEN
- begin;
- repeat
- gotoxy (3, 21);
- write('Delete List -- Are you sure?(Y/N): ');
- readln(delete);
- until (delete = 'y') or (delete = 'n');
- IF delete = 'y' THEN
- begin;
- textmode(co80);
- programname := '/c c:\tp\delhi.bat';
- swapvectors;
- exec(getenv('COMSPEC'),programname);
- swapvectors;
- textmode(co40);
- end;
-
- end;
- IF wh = '3' THEN
- begin;
- textmode(co80);
- programname := '/c c:\tp\printhi.bat';
- swapvectors;
- exec(getenv('COMSPEC'),programname);
- swapvectors;
- textmode(co40);
- end;
- end;
- procedure main;
- label
- 1, {Out of Money termination} {MNS}
- 2, {Made it Home termination} {HM}
- 3, {Repeat Loop 1 } {RPT1}
- 4, {Repeat Loop 2 } {RPT2}
- 5, {Repeat Loop 3 } {RPT3}
- 6, {About Information } {ABT}
- 8, {Quit Game } {QT}
- 9, {Short Path Selection } {ST}
- 10, {Long Path Selection } {LG}
- 11, {Lose a Player } {PLA}
- 12, {Lose Wager } {lose}
- 13, {Win wager } {win}
- 14, {Start of Procedure } {program}
- 15, {Players Gone } {PG}
- 16, {Win Short Path } {WN2}
- 17; {End of Module } {end}
- begin
- 14: IF points <= 0 THEN GOTO 1;
- IF chap > chaphigh THEN GOTO 2;
- textbackground(black);
- clrscr;
- textcolor(yellow);
- gotoxy (4, 1);
- writeln('- - - - - C H A L O - - - - -');
- textcolor(11);
- gotoxy (1, 3);
- writeln('Score = ',points);
- gotoxy (1, 5);
- writeln('Players = ',players);
- gotoxy (1, 7);
- writeln('Chap = ',chap);
- textcolor(13);
- gotoxy (1, 10);
- writeln('Press L for long path, S for short,');
- gotoxy (1, 11);
- writeln('A for about, H for high score, and ');
- gotoxy (1, 12);
- writeln('Q to quit Chalo.');
- 3: textcolor(white);
- gotoxy (1, 14);
- write('Command (L/S/A/H/Q)? ');
- read(cd);
- IF (cd = 'l') OR (cd = 's') OR (cd = 'a') OR (cd = 'h') OR (cd = 'q') THEN GOTO 5
- ELSE GOTO 3;
- 5: IF (cd = 'a') THEN GOTO 6;
- IF (cd = 'h') THEN
- begin;
- hiscore;
- end;
- IF (cd = 'q') THEN GOTO 17;
- If (cd = 'l') then goto 4;
- if (cd = 's') then goto 4;
- goto 14;
- 4: gotoxy (1, 16);
- write('Input Wager: ');
- read(wager);
- IF (wager > points) OR (wager < 1.0) THEN GOTO 4;
- gotoxy (1, 18);
- write('Hit <RETURN> to roll dice. ');
- readln(dummy);
- IF (cd = 's') THEN GOTO 9;
- 10: die1 := Trunc(random(7));
- die2 := Trunc(random(7));
- roll := die1 + die2;
- IF (roll = 6) OR (roll = 7) or (roll = 0) THEN GOTO 10;
- gotoxy (1, 20);
- writeln('You rolled a ',roll,'.');
- IF roll < 4 then GOTO 11
- ELSE IF roll > 8 THEN GOTO 12
- ELSE GOTO 13;
- 13: textcolor(12);
- gotoxy (1, 22);
- writeln('YOU WON! GOTO NEXT CHAP!');
- points := points + wager;
- chap := chap + 1;
- gotoxy (3, 24);
- write('Press <RETURN> to continue . . .');
- read(dummy);
- GOTO 14;
- 12: textcolor(11);
- gotoxy (1, 22);
- writeln('You lost your wager. Goto next chap.');
- points := points - wager;
- chap := chap + 1;
- gotoxy (3, 24);
- write('Press <RETURN> to continue . . .');
- read(dummy);
- GOTO 14;
- 11: textcolor(8);
- IF roll = 2 THEN
- begin;
- gotoxy (1, 22);
- writeln('An American Soldier mistook you for ');
- gotoxy (1, 23);
- writeln('Saddam Hussain! Your through.');
- end
- else IF roll = 3 THEN
- begin;
- gotoxy (1, 22);
- writeln('I told you it was dangerous to drive');
- gotoxy (1, 23);
- writeln('a Ford. You lost a player.');
- end
- else
- begin;
- gotoxy (1, 22);
- writeln('You idiot, next time take the long ');
- gotoxy (1, 23);
- writeln('path! You lost a player.');
- end;
- players := players - 1;
- IF players = 0 THEN GOTO 15;
- chap := chap + 1;
- gotoxy (3, 24);
- write('Press <RETURN> to continue . . .');
- read(dummy);
- GOTO 14;
- 9: die1 := trunc(random(7));
- die2 := trunc(random(7));
- roll := die1 + die2;
- IF (roll = 6) OR (roll = 7) or (roll = 0) THEN GOTO 9;
- gotoxy (1, 20);
- writeln('You rolled a ',roll,'.');
- IF roll < 6 THEN GOTO 11
- ELSE IF roll > 9 THEN GOTO 12
- ELSE GOTO 16;
- 16: textcolor(12);
- gotoxy (1, 22);
- writeln('YOU WON! SKIP A CHAP!');
- points := points + wager;
- points := points * 2;
- chap := chap + 2;
- gotoxy (3, 24);
- write('Press <RETURN> to continue . . .');
- read(dummy);
- GOTO 14;
- 15: textbackground(black);
- clrscr;
- textcolor(8);
- gotoxy (1, 12);
- writeln('You lost all your players and winnings.');
- gotoxy (1, 14);
- writeln('Better luck next time . . . ');
- gotoxy (1, 16);
- write('Press <RETURN> . . . ');
- read(dummy);
- goto 17;
- 1: textbackground(black);
- clrscr;
- textcolor(11);
- gotoxy (1, 12);
- writeln('You ran out of money.');
- gotoxy (1, 14);
- writeln('Better luck next time . . . ');
- gotoxy (1, 16);
- write('Press <RETURN> . . . ');
- read(dummy);
- goto 17;
- 2: textbackground(black);
- clrscr;
- textcolor(12);
- gotoxy (1, 12);
- writeln('You made it home!');
- gotoxy (1, 14);
- writeln('Score = ',points);
- gotoxy (1, 16);
- write('Enter your name: ');
- readln(name);
- outputdata;
- gotoxy (1, 18);
- writeln('Your high score has been saved.');
- gotoxy (1, 20);
- write('Press <RETURN> to continue . . . ');
- read(dummy);
- goto 17;
- 6: textbackground(black);
- clrscr;
- textcolor(14);
- gotoxy (4, 1);
- writeln('- - - - - C H A L O - - - - -');
- textcolor(12);
- gotoxy (11, 6);
- writeln('Chalo Version 4.0');
- gotoxy (11, 10);
- writeln('Created 1-21-95');
- gotoxy (12, 15);
- writeln('By Terry Uland');
- gotoxy (2, 20);
- writeln('Copyright (C) 1995 Uland Industries');
- textcolor(white);
- gotoxy (3, 23);
- write('Press <RETURN> to continue . . .');
- readln;
- readln(dumass);
- if dumass = 'CDR' then chap := chaphigh + 1;
- GOTO 14;
- 8: textcolor(white);
- gotoxy (3, 16);
- write('Quit -- Are you sure?(Y/N): ');
- readln(quit);
- IF (quit = 'y') THEN goto 17;
- goto 14;
- 17:
- end;
- {label
- 1,
- 2;}
- begin;
- Initialize; {Initialize variables, screen and path}
- Title; {Title Page }
- Prochoice; {Choice of Level }
- Main; {Main Program }
- END. {End of Program }
-
-
-
-
-
-
-
-
-